//
//  MyAccountController.m
//  i5db
//
//  Created by iMuse on 15-5-13.
//  Copyright (c) 2015年 mySelf. All rights reserved.
//

#import "MyAccountController.h"
#import "AppCenter.h"
#import "AppButtonView.h"

@interface MyAccountController ()

@end

@implementation MyAccountController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"账户";
    }
    return self;
}

-(void)updateViewConstraints
{
    [super updateViewConstraints];
    
}

-(void)initNavigationBar
{
    [super initNavigationBar];
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initNavigationBar];
    [self initView];
    
}
-(void) initView
{
    AppButtonView * sourceButton = [AppButtonView newAutoLayoutView];
    
    [sourceButton setLeftText:@"当前积分"];
    [sourceButton hiddenLine];
    [sourceButton setRightText:@"2000"];
    [self.view addSubview:sourceButton];
    [sourceButton autoPinToTopLayoutGuideOfViewController:self withInset:10];
    [sourceButton autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [sourceButton autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [sourceButton autoSetDimension:ALDimensionHeight toSize:40];
    
    UILabel * sourceLabel = [UILabel newAutoLayoutView];
    sourceLabel.text = @"积分规则奖励规则";
    sourceLabel.font = [UIFont boldSystemFontOfSize:12];
    [self.view addSubview:sourceLabel];
    [sourceLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:sourceButton withOffset:15];
    [sourceLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
    
    NSArray * array1 = [NSArray arrayWithObjects:@"1、新用户注册即可得到20个积分",@"2、新用户完善信息（手机号，邮箱等）即可再次获得20个积分",@"3、用户通过后台设置等到推广链接 成功注册一个得10个积分，完善资料的优质用户得20个积分",@"4、每日首发信息得10个积分",@"5、每日登陆获得20个积分", nil];
    
    UILabel * label;
    for (NSInteger i=0; i<array1.count; i++)
    {
        label = [[UILabel alloc] init];
        label.text = [array1 objectAtIndex:i];
        label.numberOfLines = 0;
        label.textColor = [AppCenter color:@"126,126,126,1"];
        label.font = [UIFont systemFontOfSize:12];
        [self.view addSubview:label];
        [label autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:sourceLabel withOffset:5+i*30];
        [label autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
        [label autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:10];
        [label autoSetDimension:ALDimensionHeight toSize:30];
    }
    
    
    UILabel * xiaohaoLabel = [UILabel newAutoLayoutView];
    xiaohaoLabel.font = sourceLabel.font;
    xiaohaoLabel.textColor = sourceLabel.textColor;
    xiaohaoLabel.text = @"积分消耗规则";
    [self.view addSubview:xiaohaoLabel];
    [xiaohaoLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:label withOffset:15];
    [xiaohaoLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
    
    
    NSArray* array2 = [NSArray arrayWithObjects:@"1、查看别人信息需要5个积分",@"2、积分商城兑换积分需要消耗相应的积分", nil];
    for (NSInteger i=0; i<array2.count; i++)
    {
       UILabel*  label = [[UILabel alloc] init];
        label.text = [array2 objectAtIndex:i];
        label.numberOfLines = 0;
        label.textColor = [AppCenter color:@"126,126,126,1"];
        label.font = [UIFont systemFontOfSize:12];
        [self.view addSubview:label];
        [label autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:xiaohaoLabel withOffset:5+i*30];
        [label autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
        [label autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:10];
        [label autoSetDimension:ALDimensionHeight toSize:30];
    }
 
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
   
}
- (void)viewWillAppear:(BOOL)animated {
    
    
    [[self rdv_tabBarController] setTabBarHidden:YES animated:NO];
    [super viewWillAppear:animated];
    
    
}


- (void)viewWillDisappear:(BOOL)animated {
    
    [[self rdv_tabBarController] setTabBarHidden:NO animated:YES];
    
    [super viewWillDisappear:animated];
}


@end
